package com.opener.web.spring.event;

import org.springframework.context.event.SimpleApplicationEventMulticaster;
import org.springframework.core.task.TaskExecutor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by baboy on 19/12/2016.
 */
public class AsyncAppEventMulticaster extends SimpleApplicationEventMulticaster {
    private TaskExecutor taskExecutor = new TaskExecutor() {
        ExecutorService service = Executors.newCachedThreadPool();
        public void execute(Runnable task) {
            service.execute(task);
        }
    };

    protected TaskExecutor getTaskExecutor() {
        return this.taskExecutor;
    }
}
